﻿#ifndef MASTER_H
#define MASTER_H

#include <QObject>
#include <QTimer>

#include <QtSerialPort/QSerialPort>


class Master : public QObject
{
	Q_OBJECT
public:
	Master();

private slots:
	void sendRequest(QString portName, QString str);
	void readResponse();
	void processTimeout();

private:
	void setControlsEnabled(bool enable);
	void processError(const QString& error);

	int m_transactionCount = 0;

	QSerialPort m_serial;
	QByteArray m_response;
	QTimer m_timer;

	int wait_time;
};

#endif // MASTER_H
